<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

/**
 * 生成密码规则
 * @param $value
 * @return string
 */
function getPassRule($value)
{
    return md5($value . 'phCms');
}

/**
 * 操作结果返回
 * @param $res
 * @param $jumpAddress
 * @return \think\response\Json
 */
function operationResult($res, $jumpAddress = '')
{
    if ($res) {
        return json(['code' => 200, 'message' => '操作成功', 'jumpAddress' => $jumpAddress]);
    } else {
        return json(['code' => 100, 'message' => '操作失败']);
    }
}

/**
 * 运营管理 - 账户状态转换
 * @param $v
 * @return mixed
 */
function changeAdminStatus($v)
{
    $data = ['冻结', '正常'];
    return $data[$v];
}

/**
 * 运营管理 - 账户类型转换
 * @param $v
 * @return mixed
 */
function changeAdminType($v)
{
    $data = ['普通', '管理员'];
    return $data[$v];
}
